/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * THIS FILE IS AUTOGENERATED BY arktscgen v2.1.9-arktscgen-6. DO NOT EDIT MANUALLY!
 * es2panda fe7c2bfd7c50a1bef62bcedaac78ba82000e6c39(2025-07-10) sdk v1.5.0-dev.36516
 */

import {
    global,
    passNode,
    passNodeArray,
    unpackNonNullableNode,
    unpackNode,
    unpackNodeArray,
    assertValidPeer,
    AstNode,
    KNativePointer,
    nodeByType,
    ArktsObject,
    unpackString
} from "../../reexport-for-generated"

import { Es2pandaAstNodeType } from "./../Es2pandaEnums"
import { TypeNode } from "./TypeNode"

export class ETSTuple extends TypeNode {
    constructor(pointer: KNativePointer) {
        assertValidPeer(pointer, 83)
        super(pointer)
    }
    static createETSTuple(): ETSTuple {
        const result: ETSTuple = new ETSTuple(global.generatedEs2panda._CreateETSTuple(global.context))
        result.setChildrenParentPtr()
        return result
    }
    static updateETSTuple(original?: ETSTuple): ETSTuple {
        const result: ETSTuple = new ETSTuple(global.generatedEs2panda._UpdateETSTuple(global.context, passNode(original)))
        result.setChildrenParentPtr()
        return result
    }
    static create1ETSTuple(size: number): ETSTuple {
        const result: ETSTuple = new ETSTuple(global.generatedEs2panda._CreateETSTuple1(global.context, size))
        result.setChildrenParentPtr()
        return result
    }
    static update1ETSTuple(original: ETSTuple | undefined, size: number): ETSTuple {
        const result: ETSTuple = new ETSTuple(global.generatedEs2panda._UpdateETSTuple1(global.context, passNode(original), size))
        result.setChildrenParentPtr()
        return result
    }
    static create2ETSTuple(typeList: readonly TypeNode[]): ETSTuple {
        const result: ETSTuple = new ETSTuple(global.generatedEs2panda._CreateETSTuple2(global.context, passNodeArray(typeList), typeList.length))
        result.setChildrenParentPtr()
        return result
    }
    static update2ETSTuple(original: ETSTuple | undefined, typeList: readonly TypeNode[]): ETSTuple {
        const result: ETSTuple = new ETSTuple(global.generatedEs2panda._UpdateETSTuple2(global.context, passNode(original), passNodeArray(typeList), typeList.length))
        result.setChildrenParentPtr()
        return result
    }
    get tupleSize(): number {
        return global.generatedEs2panda._ETSTupleGetTupleSizeConst(global.context, this.peer)
    }
    get tupleTypeAnnotationsList(): readonly TypeNode[] {
        return unpackNodeArray(global.generatedEs2panda._ETSTupleGetTupleTypeAnnotationsList(global.context, this.peer))
    }
    /** @deprecated */
    setTypeAnnotationsList(typeNodeList: readonly TypeNode[]): this {
        global.generatedEs2panda._ETSTupleSetTypeAnnotationsList(global.context, this.peer, passNodeArray(typeNodeList), typeNodeList.length)
        return this
    }
    protected readonly brandETSTuple: undefined
}
export function isETSTuple(node: object | undefined): node is ETSTuple {
    return node instanceof ETSTuple
}
if (!nodeByType.has(Es2pandaAstNodeType.AST_NODE_TYPE_ETS_TUPLE)) {
    nodeByType.set(Es2pandaAstNodeType.AST_NODE_TYPE_ETS_TUPLE, (peer: KNativePointer) => new ETSTuple(peer))
}
